More pieces.
authorrobertlipe@gmail.com <robertlipe@gmail.com@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 1 Jan 2014 04:10:41 +0000 (04:10 +0000)
committerrobertlipe@gmail.com <robertlipe@gmail.com@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 1 Jan 2014 04:10:41 +0000 (04:10 +0000)
git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4691 f51c46e8-681c-474f-0cfe-069cfd0219fb

gpsbabel/bend.cc
gpsbabel/mmo.cc
gpsbabel/pcx.cc
gpsbabel/pocketfms_bc.cc
gpsbabel/pocketfms_fp.cc
gpsbabel/pocketfms_wp.cc
gpsbabel/psitrex.cc

index f77ac4a3c876cd4df56de8a104dbcb993b24fcf4..ef7d58b91978d0f01a4705aaf52dcc7b010a6837 100644 (file)
@@ -175,8 +175,8 @@ static void
 process_route_orig(const route_head* route_orig)
 {
   route_head* route_dest = route_head_alloc();
-  route_dest->rte_name = xstrdup(route_orig->rte_name);
-  route_dest->rte_desc = xstrdup(route_orig->rte_desc);
+  route_dest->rte_name = route_orig->rte_name;
+  route_dest->rte_desc = route_orig->rte_desc;
   route_dest->fs = fs_chain_copy(route_orig->fs);
   route_dest->rte_num = route_orig->rte_num;
 
index b43a31332336525507c86ce3b5975b618c826dda..b6b9e6b9de9e89f61f9ab35ace122182dcb43e55 100644 (file)
@@ -461,11 +461,7 @@ mmo_read_CObjWaypoint(mmo_data_t* data)
        data->name, data->visible ? "yes" : "NO", data->objid));
 
   data->data = wpt = waypt_new();
-#if NEW_STRINGS
   wpt->shortname = QString::fromLatin1(data->name);
-#else
-  wpt->shortname = xstrdup(data->name);
-#endif
 
   time = data->mtime;
   if (! time) {
@@ -609,7 +605,7 @@ mmo_read_CObjRoute(mmo_data_t* data)
        data->name, data->visible ? "yes" : "NO", data->objid));
 
   data->data = rte = route_head_alloc();
-  rte->rte_name = xstrdup(data->name);
+  rte->rte_name = data->name;
   route_add_head(rte);
 
   if (mmo_version >= 0x18) {
@@ -684,7 +680,7 @@ mmo_read_CObjTrack(mmo_data_t* data)
        data->name, data->visible ? "yes" : "NO", data->objid));
 
   trk = route_head_alloc();
-  trk->rte_name = xstrdup(data->name);
+  trk->rte_name = data->name;
   track_add_head(trk);
 
   if (mmo_version >= 0x18) {
@@ -994,24 +990,10 @@ mmo_finalize_rtept_cb(const waypoint* wptref)
 
     wpt->latitude = wpt2->latitude;
     wpt->longitude = wpt2->longitude;
-#if NEW_STRINGS
     wpt->shortname = (wpt2->shortname);
-#else
-    xfree(wpt->shortname);
-    wpt->shortname = xstrdup(wpt2->shortname);
-#endif
 
-#if NEW_STRINGS
-      wpt->description = (wpt2->description);
-      wpt->notes = (wpt2->notes);
-#else
-    if (wpt2->description) {
-      wpt->description = xstrdup(wpt2->description);
-    }
-    if (wpt2->notes) {
-      wpt->notes = xstrdup(wpt2->notes);
-    }
-#endif
+    wpt->description = (wpt2->description);
+    wpt->notes = (wpt2->notes);
     if (wpt2->HasUrlLink()) {
       UrlLink l = wpt2->GetUrlLink();
       wpt->notes = xstrdup(l.url_.toUtf8().data());
index c847ff4587a6892c859d9c2af3df3ceda5d76540..8a72fc8c89dd07c255f73af8a910e457c16a3eeb 100644 (file)
@@ -157,11 +157,11 @@ data_read(void)
       wpt_tmp->altitude = alt;
       cp = lrtrim(name);
       if (*cp != '\0') {
-        wpt_tmp->shortname = xstrdup(cp);
+        wpt_tmp->shortname = cp;
       }
       cp = lrtrim(desc);
       if (*cp != '\0') {
-        wpt_tmp->description = xstrdup(cp);
+        wpt_tmp->description = cp;
       }
       wpt_tmp->icon_descr = gt_find_desc_from_icon_number(symnum, PCX, NULL);
 
@@ -202,11 +202,11 @@ data_read(void)
       if (track == NULL) {
         if (ibuf[3] == 'L' && ibuf[4] == 'A') {
           track = route_head_alloc();
-          track->rte_name = xstrdup("track");
+          track->rte_name = "track";
           track_add_head(track);
         } else if (ibuf[3] == 'T' && ibuf[4] == 'N') {
           track = route_head_alloc();
-          track->rte_name = xstrdup(&ibuf[6]);
+          track->rte_name = &ibuf[6];
           track_add_head(track);
         }
       }
@@ -217,7 +217,7 @@ data_read(void)
         n++;
       }
       route = route_head_alloc();
-      route->rte_name = xstrdup(&ibuf[n]);
+      route->rte_name = &ibuf[n];
       route_add_head(route);
       break;
     case 'T':
@@ -266,7 +266,7 @@ data_read(void)
       /* Did we get a track point before a track header? */
       if (track == NULL) {
         track = route_head_alloc();
-        track->rte_name = xstrdup("Default");
+        track->rte_name = "Default";
         track_add_head(track);
       }
       track_add_wpt(track, wpt_tmp);
index 9d9ada54df6057e8313a00291ca60bd9a5228a85..fc1d4bcf99bcaee3eb9571decd69f51eb62c8a21 100644 (file)
@@ -83,8 +83,8 @@ read_tracks(void)
   struct breadcrumb bc;
   route_head* trk_head = route_head_alloc();
   trk_head->rte_num = 1;
-  trk_head->rte_name = xstrdup("PocketFMS");
-  trk_head->rte_desc = xstrdup("Breadcrumb");
+  trk_head->rte_name = "PocketFMS";
+  trk_head->rte_desc = "Breadcrumb";
   trk_head->rte_url = "www.pocketfms.com";
   track_add_head(trk_head);
 
index c317ff22a7acfad0f8399b810c02e75e651a7baf..83d0bc5b121f3226881746246eaf38fd0e765471 100644 (file)
@@ -68,19 +68,11 @@ rd_deinit(void)
     waypoint* head = (waypoint*) QUEUE_FIRST(&route->waypoint_list);
     waypoint* tail = (waypoint*) QUEUE_LAST(&route->waypoint_list);
     if (head != NULL) {
-      route->rte_name = xstrdup(head->shortname);
+      route->rte_name = head->shortname;
     }
-#if NEW_STRINGS
     route->rte_name += " - ";
-#else
-    route->rte_name = xstrappend(route->rte_name, " - ");
-#endif
     if (tail != NULL) {
-#if NEW_STRINGS
       route->rte_name += tail->shortname;
-#else
-      route->rte_name = xstrappend(route->rte_name, tail->shortname);
-#endif
       tail->altitude = dest_altitude;
     }
   }
@@ -98,7 +90,7 @@ void  wpt_s(xg_string args, const QXmlStreamAttributes* unused)
   if (isFirst == 1) {
     wpt_from = waypt_new();
     route = route_head_alloc();
-    route->rte_desc=xstrdup("PocketFMS flightplan");
+    route->rte_desc="PocketFMS flightplan";
     route_add_head(route);
   }
   wpt_to = waypt_new();
@@ -124,81 +116,49 @@ void      wpt_e(xg_string args, const QXmlStreamAttributes* unused)
 void   wpt_from_lat(xg_string args, const QXmlStreamAttributes* unused)
 {
   if (wpt_from != NULL) {
-#if NEW_STRINGS
     wpt_from->latitude = args.toDouble();
-#else
-    wpt_from->latitude = atof(args);
-#endif
   }
 }
 
 void   wpt_from_lon(xg_string args, const QXmlStreamAttributes* unused)
 {
   if (wpt_from != NULL) {
-#if NEW_STRINGS
     wpt_from->longitude = args.toDouble();
-#else
-    wpt_from->longitude = atof(args);
-#endif
   }
 }
 
 void   wpt_from_name(xg_string args, const QXmlStreamAttributes* unused)
 {
   if (wpt_from != NULL) {
-#if NEW_STRINGS
     wpt_from->shortname += args;
-#else
-    wpt_from->shortname = xstrappend(wpt_from->shortname, args);
-#endif
   }
 }
 
 void   wpt_from_elev(xg_string args, const QXmlStreamAttributes* unused)
 {
   if (wpt_from != NULL) {
-#if NEW_STRINGS
     wpt_from->altitude = FEET_TO_METERS(args.toDouble());
-#else
-    wpt_from->altitude = FEET_TO_METERS(atof(args));
-#endif
   }
 }
 
 void   wpt_to_lat(xg_string args, const QXmlStreamAttributes* unused)
 {
-#if NEW_STRINGS
   wpt_to->latitude = args.toDouble();
-#else
-  wpt_to->latitude = atof(args);
-#endif
 }
 
 void   wpt_to_lon(xg_string args, const QXmlStreamAttributes* unused)
 {
-#if NEW_STRINGS
   wpt_to->longitude = args.toDouble();
-#else
-  wpt_to->longitude = atof(args);
-#endif
 }
 
 void   wpt_to_name(xg_string args, const QXmlStreamAttributes* unused)
 {
-#if NEW_STRINGS
   wpt_to->shortname += args;
-#else
-  wpt_to->shortname = xstrappend(wpt_to->shortname, args);
-#endif
 }
 
 void   wpt_to_elev(xg_string args, const QXmlStreamAttributes* unused)
 {
-#if NEW_STRINGS
   dest_altitude = FEET_TO_METERS(args.toDouble());
-#else
-  dest_altitude = FEET_TO_METERS(atof(args));
-#endif
 }
 
 void   wpt_altitude(xg_string args, const QXmlStreamAttributes* attrv)
index 2791154854e3e1b2e7d14818c19574f86652e937..2521f9220e2c40088742535126755533d3e8cc6d 100644 (file)
@@ -71,7 +71,7 @@ data_read(void)
     if (!s) {
       fatal(MYNAME "Invalid name");
     }
-    wpt->shortname = xstrdup(s);
+    wpt->shortname = s;
     s = csv_lineparse(NULL, "\\w", "", linecount);
     if (!s) {
       fatal(MYNAME "Invalid latitude %s", CSTRc(wpt->shortname));
@@ -126,7 +126,7 @@ enigma_waypt_disp(const waypoint* wpt)
     }
     *d = 0;
   } else {
-    t = xstrdup("NONAME");
+    t = "NONAME";
   }
   gbfprintf(file_out, "%s %f %f\n", t, wpt->latitude, wpt->longitude);
   xfree(t);
index f7beaa43436da5cd70f1f53f4eb6f97f2ccb9849..bc5fdacb3f80fc8221169272d4c9833d1848a8e2 100644 (file)
@@ -318,8 +318,8 @@ psit_waypoint_r(gbfile* psit_file, waypoint** wpt)
     /* the name */
     psit_getToken(psit_file,psit_current_token,sizeof(psit_current_token), comma);
     rtrim(psit_current_token);
-    thisWaypoint->shortname = xstrdup(psit_current_token);
-    thisWaypoint->description = xstrdup("");
+    thisWaypoint->shortname = psit_current_token;
+    thisWaypoint->description = "";
 
     psit_getToken(psit_file,psit_current_token,sizeof(psit_current_token), ltrimEOL);
     rtrim(psit_current_token);
@@ -411,7 +411,7 @@ psit_route_r(gbfile* psit_file, route_head** rte)
   rtrim(rtename);
 
   rte_head = route_head_alloc();
-  rte_head->rte_name = xstrdup(rtename);
+  rte_head->rte_name = rtename;
   route_add_head(rte_head);
   *rte = rte_head;
 
@@ -440,8 +440,8 @@ psit_route_r(gbfile* psit_file, route_head** rte)
       /* the name */
       psit_getToken(psit_file,psit_current_token,sizeof(psit_current_token), comma);
       rtrim(psit_current_token);
-      thisWaypoint->shortname = xstrdup(psit_current_token);
-      thisWaypoint->description = xstrdup("");
+      thisWaypoint->shortname = psit_current_token;
+      thisWaypoint->description = "";
 
       psit_getToken(psit_file,psit_current_token,sizeof(psit_current_token), ltrimEOL);
       rtrim(psit_current_token);
@@ -539,7 +539,6 @@ psit_routehdr_w_wrapper(const route_head* rte)
 static void
 psit_track_r(gbfile* psit_file, route_head** trk)
 {
-  char tbuf[100];
   char trkname[256];
   unsigned int trk_num;
 
@@ -612,10 +611,9 @@ psit_track_r(gbfile* psit_file, route_head** trk)
          tracklog is usually ACTIVE LOG
          the second is ACTIVE LOG001 and so on */
         if (trk_num > 0) {
-          sprintf(tbuf, "%s%03d", trkname, trk_num);
-          track_head->rte_name = xstrdup(tbuf);
+          track_head->rte_name = QString().sprintf("%s%03d", trkname, trk_num);
         } else {
-          track_head->rte_name = xstrdup(trkname);
+          track_head->rte_name = trkname;
         }
         trk_num++;
         track_add_head(track_head);